#ifndef TAXONOMY_TREE_H
#define TAXONOMY_TREE_H
#include "ti_3D.h"
#include "tplate.h"
//please refer to the 2D case comments
typedef struct {
    float *stat;                
} one_node;                    

typedef struct {
    one_node *node;           
    int NR_cate;             
} taxonomy_tree;

typedef struct {
    taxonomy_tree **t_tree; 
    int max_scale;
} ALL_taxonomy_tree;       

taxonomy_tree *init_taxonomy_tree(int tpsize, int NR_cate);
void update_taxonomy_tree(taxonomy_tree * t_tree,
                          int *cur_value, int *neigh_value,
                          int tp_position);
taxonomy_tree *build_taxonomy_tree_3D(train_grid_3D * ti, tplate * tp,
                                      int g);
void search_taxomony_tree(float *result, taxonomy_tree * t_tree,
                          int tp_position, int *cond, float *marginal);
void save_taxonomy_tree(ALL_taxonomy_tree * alltree, int tpsize,
                        char *filename);
void load_taxonomy_tree(ALL_taxonomy_tree * alltree, int tpsize,
                        char *filename);
float *extract_all_pdf(data_event * dv, taxonomy_tree * t_tree,
                       float *marginal, int NR_cate);
#endif                            /* ifndef TAXONOMY_TREE_H */
